const db = require('../config/db')

const format = {
  // 姓名
  name: {
    type: String,
    required: true
  },
  // 性别
  sex: {
    type: String,
    required: true
  },
  // 年龄
  age: {
    type: Number,
    required: true
  },
  // 生日
  birthday: {
    type: String,
    required: true
  }
}

const schemaFreshman = new db.Schema(format, { collection: 'freshman' })
const schemaSophomore = new db.Schema(format, { collection: 'sophomore' })
const schemaJunior = new db.Schema(format, { collection: 'junior' })
const schemaSenior = new db.Schema(format, { collection: 'senior' })

module.exports = {
  Freshman: db.model('freshman', schemaFreshman),
  Sophomore: db.model('sophomore', schemaSophomore),
  Junior: db.model('junior', schemaJunior),
  Senior: db.model('senior', schemaSenior)
}